﻿#if NETCore
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace Bootstrap.Security.Controller
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [AllowAnonymous]
    public class InterfaceController : ControllerBase
    {
        [HttpPost]
        public BootstrapUser RetrieveUserByUserName([FromBody]string userName)
        {
            return new BootstrapUser()
            {
                UserName = userName,
                Css = "css",
                DisplayName = "Unit Test",
                Icon = "fa fa-fa"
            };
        }

        [HttpPost]
        public IEnumerable<BootstrapDict> RetrieveDicts()
        {
            return new BootstrapDict[] { new BootstrapDict() { Id = "1", Name = "UnitTest", Code = "UnitTest", Category = "UnitTest", Define = 0 } };
        }

        [HttpPost]
        public IEnumerable<BootstrapGroup> RetrieveGroups()
        {
            return new BootstrapGroup[] { new BootstrapGroup() { Id = "1", GroupName = "UnitTest", GroupCode = "UnitTest" } };
        }

        [HttpPost]
        public IEnumerable<string> RetrieveRolesByUserName([FromBody]string userName)
        {
            return new string[] { "Administrators" };
        }

        [HttpPost]
        public IEnumerable<string> RetrieveRolesByUrl([FromBody]string url)
        {
            return new string[] { "Administrators" };
        }

        [HttpPost]
        public IEnumerable<BootstrapMenu> RetrieveAppMenus()
        {
            return new BootstrapMenu[] { new BootstrapMenu() { Id = "1", ParentId = "0", Category = "0", Name = "UnitTest" } };
        }
    }
}
#endif
